package com.crm.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.crm.pojo.domain.User;
import com.crm.pojo.dto.LoginDto;
import com.crm.pojo.dto.UserDto;
import com.crm.pojo.vo.DeptVo;
import com.crm.pojo.vo.TransferUserVo;
import com.crm.pojo.vo.UserVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    User getLoginUser(LoginDto loginDto);

    List<UserVo> list(UserDto userDto);

    void add(User user);

    void addUserRole(Integer userId, List roleIds);

    Long count(String phonenumber, String userName, String beginTime, String endTime);

    List<TransferUserVo> selectTransfer(Integer startNum, Integer pageSize, String phonenumber, String userName, LocalDateTime beginTime, LocalDateTime endTime);
    void addUserRole(Long userId, List roleIds);
    @Select("select * from user where user_name=#{username}")
    User getUserByUserName(String username);
    @Delete("delete from user where user_id = #{userId}")
    void del(Integer userId);
    @Delete("delete from user_role where user_id = #{userId}")
    void delRole(Integer userId);
}

